﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class Main_Reports_ServiceInvoice_CreditNoteDisplay : System.Web.UI.Page
{
    Datautility DU = new Datautility();
    string strSql = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            Response.Redirect("~/SessionExpired.aspx");
        }
        if (!IsPostBack)
        {
            if (Session["FINYEAR"] != null)
            {
                _BindCreditNote(Session["FINYEAR"].ToString());
            }
        }
    }
    private void _BindCreditNote(string strFinyear)
    {
        if (strFinyear != string.Empty)
        {
            SqlParameter[] sparam ={
                                       new SqlParameter("@FINYEAR",strFinyear)
                                   };
            DataTable DTCreditNote = DU.getdatausingprocedure("USP_IVC_GetCreditNoteMainDetails", sparam);
            grdDisplay.DataSource = DTCreditNote;
            grdDisplay.DataBind();
        }
    }
    protected void grdDisplay_RowBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string strCreditNoteId = grdDisplay.DataKeys[e.Row.RowIndex].Value.ToString();
            HyperLink hyperView = (HyperLink)e.Row.FindControl("hyperView");
            hyperView.Attributes.Add("onclick", "return OpenDetails('" + strCreditNoteId + "');");
        }
    }
}
